package day8;

import java.util.Scanner;

public abstract class musical {
    public abstract void play();
}

class ErHu extends musical{
    @Override
    public void play() {
        System.out.println("正在演奏二胡！！！");
    }
}

class piano extends musical{
    @Override
    public void play() {
        System.out.println("正在演奏钢琴！！！");
    }
}

class violin extends musical{
    @Override
    public void play() {
        System.out.println("正在演奏小提琴！！！");
    }
}

class TestMusical{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入弹奏的乐器 1.二胡 2.钢琴 3.小提琴");
        int choose = sc.nextInt();
        musical ml=null;
        switch (choose){
            case 1: ml = new ErHu();break;
            case 2: ml = new piano();break;
            case 3: ml = new violin();break;
        }
        ml.play();
    }
}